﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using NHibernate;
using dbPoll_Application.Helpers;
using NHibernate.Linq;

namespace dbPoll_Application.Models
{
    public static class ClientCodeRepository
    {
        public static ClientCode GetClientCodeByUserName(String username)
        {
            ISession session = NHibernateHelper.GetCurrentSession();
            var code = from item in session.Query<ClientCode>()
                        where item.Owner.UserName == username
                        select item;
            return code.FirstOrDefault<ClientCode>();
        }
    }
}
